<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="">
<meta name="description" content="">

<link rel="shortcut icon" href="favicon.ico">
<link href="/hadmin/css/bootstrap.min.css" rel="stylesheet">
<link href="/hadmin/css/font-awesome.css" rel="stylesheet">
<link href="/hadmin/css/animate.css" rel="stylesheet">
<link href="/hadmin/css/style.css" rel="stylesheet">

</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="frm" method="post" action="/admin/user/edit">
							<div class="form-group">
								<label class="col-sm-3 control-label">账户名:</label>
								<div class="col-sm-8">
									<input id="userName" name="userName" class="form-control" type="text" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">昵称：</label>
								<div class="col-sm-8">
									<input id="nickName" name="nickName" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">性别：</label>
								<div class="col-sm-8">
									<select name="sex" class="form-control">
										<option value="0" selected="selected">女</option>
										<option value="1" selected="selected">男</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">出生日期：</label>
								<div class="col-sm-8">
									<input id="birthday" name="birthday" readonly="readonly" class="laydate-icon form-control layer-date"">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">电话：</label>
								<div class="col-sm-8">
									<input id="telephone" name="telephone" class="form-control">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">E-mail：</label>
								<div class="col-sm-8">
									<input id="email" name="email" class="form-control">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">地址：</label>
								<div class="col-sm-8">
									<input id="address" name="address" class="form-control">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">状态：</label>
								<div class="col-sm-8">
									<select name="locked" class="form-control">
										<option value="0" selected="selected">未锁定</option>
										<option value="1" selected="selected">锁定</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">描述：</label>
								<div class="col-sm-8">
									<input id="description" name="description" class="form-control">
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button class="btn btn-primary" type="submit">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

	</div>
	<!-- 全局js -->
	<div th:include="/admin/common/common"></div>
	<script type="text/javascript">
		$(document)
				.ready(
						function() {
							//外部js调用
							laydate({
								elem : '#birthday', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
								event : 'focus' //响应事件。如果没有传入event，则按照默认的click
							});

							$("#frm")
									.validate(
											{
												rules : {
													userName : {
														required : true,
														minlength : 4,
														maxlength : 10
													},
													nickName : {
														required : true,
														minlength : 4,
														maxlength : 10
													},
													sex : {
														required : true
													},
													birthday : {
														date : true,
														required : true
													},
													telephone : {
														required : true
													},
													email : {
														email : true,
														required : true
													},
													address : {
														required : true,
														maxlength : 40
													},
													locked : {
														required : true
													},
													description : {
														required : true,
														maxlength : 40
													}
												},
												messages : {},
												submitHandler : function(form) {
													$
															.ajax({
																type : "POST",
																dataType : "json",
																url : "/admin/user/edit",
																data : $(form)
																		.serialize(),
																success : function(
																		msg) {
																	layer
																			.msg(
																					msg.message,
																					{
																						time : 2000
																					},
																					function() {
																						var index = parent.layer
																								.getFrameIndex(window.name); //先得到当前iframe层的索引
																						parent.layer
																								.close(index);
																					});
																}
															});
												}
											});
						});
	</script>

</body>

</html>
